<%@page import="com.ebookstore.struts.form.CartForm"%>
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="IncludeHeader.jsp"%>
<html>
  <head>
    <title>网上书店</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <link rel="stylesheet" type="text/css" href="<html:rewrite page="/style.css"/>">
  </head>
  
  <body>
    <div class="content">
    <%@ include file="IncludeTop.jsp"%>
   <div class="cart">
   
   <logic:equal name="cartForm.cart.numberOfItems" value="0">
  	 您还没有选中书
   </logic:equal>
   
   <html:form action="/cartAction">
	<table border="0" width="100%">
	<tr class="tr_head">
		<td>书号</td>
		<td>售价</td>
		<td>折扣</td>
		<td>折后价格</td>
		<td>数量</td>
		<td>操作</td>
	</tr>
	
	<logic:present name="cartForm">
		<logic:iterate id="item" collection="${ cartForm.cart.cartItemList.pageList }">
<%CartForm c =(CartForm)session.getAttribute("cartForm");
if(c==null)
	System.out.println("cart.jsp CartForm==null");//真的为空
%>
			<tr>
				<td>${item.item.itemId}</td>
				<td>${item.item.baseprice}</td>
				<td>${item.item.discount*100}%</td>
				<td>${item.totalPrice}</td>
				<td><input type="text" name="quantity_${item.item.itemId}" value="${item.quantity}"/>
				
				</td>
				<td>
				<input type="button" class="normalButton" value="删除"
				onclick="window.location.href='<html:rewrite page="/cartAction.do?method=removeItem&itemId=${item.item.itemId}"/>'" />
				</td>
			</tr>
		</logic:iterate>
	</logic:present>
		<tr>
		<td colspan="6" align=right>
		合计：${cartForm.cart.subTotal}
		</td>
	</tr>
	<tr>
		<td colspan="6" align=right>
			<html:submit value="更新数量" styleClass="normalButton"></html:submit>
			<input type="button" class="normalButton" value="结帐"
				onclick="window.location.href='<html:rewrite page="/cartAction.do?method=checkout"/>'" />
			<input type="button" class="normalButton" value="继续购物"
				onclick="window.location.href='<html:rewrite page="/index.do"/>'" />	
		</td>
	</tr>
</table>

<input type="hidden" name="method" value="updateQuantity"/>
</html:form>
</div>
       </div>
  </body>
</html>
